package com.zhaol.oa.controller;


import com.zhaol.oa.entity.Fitment;
import com.zhaol.oa.mapper.FitmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
@RestController
@CrossOrigin
public class FitmentController {
    @Autowired
    private FitmentMapper fitmentMapper;

    @RequestMapping("/selectFitmentList")
    public List<Fitment> selectFitmentList(Fitment fitment) {
        return fitmentMapper.selectFitment(fitment);
    }
    @RequestMapping("/getFitmentCount")
    public int getCostCount(Fitment fitment){
        return fitmentMapper.getCount(fitment);

    }
    @RequestMapping("/deleteFitmentAll")
    public  void deleteHospitalAll(String ids){
        String[] split = ids.split(",");
        List<Integer> arrayList=new ArrayList<Integer>();
        for ( String iid:split) {
            arrayList.add(Integer.parseInt(iid));
        }
        fitmentMapper.deleteFitmentAll(arrayList);
    }
    @RequestMapping("/addFitment")
    public void addKd(Fitment fitment){
        fitmentMapper.addFitment(fitment);
    }
    @RequestMapping("/updateFitment")
    public void updateFitment(Fitment fitment){
        fitmentMapper.updateFitment(fitment);
    }
}
